package com.weasel.im.common.manager;

import com.weasel.im.common.cache.DefaultLeaveMessageCache;
import com.weasel.im.common.cache.LeaveMessageCache;
import com.weasel.im.common.domain.Message;

import java.util.List;

/**
 * Created by Dylan on 2015/12/3.
 */
public class LeaveMessageCacheManager {

    private LeaveMessageCache leaveMessageCache = new DefaultLeaveMessageCache();


    public void cache(Message message){
        leaveMessageCache.cache(message);
    }

    /**
     * @param username
     * @return
     */
    public List<Message> getAndRemove(String username){
        return leaveMessageCache.getAndRemove(username);
    }

    public LeaveMessageCache getLeaveMessageCache() {
        return leaveMessageCache;
    }

    public void setLeaveMessageCache(LeaveMessageCache leaveMessageCache) {
        this.leaveMessageCache = leaveMessageCache;
    }
}
